# -*- coding: utf-8 -*-
import os
from robot import run_cli

def run_robot_tests():
    test_dir = r"D:\RF_migu\rf_migu\UGC\TestCases"
    # 获取目录下所有的 .robot 文件
    robot_files = []
    for root, dirs, files in os.walk(test_dir):
        for file in files:
            if file.endswith('.robot') and file != '__init__.robot':
                robot_files.append(os.path.join(root, file))

    # 构建 Robot Framework 命令行参数
    cli_args = robot_files
    # 运行测试
    run_cli(cli_args, exit=False)

if __name__ == "__main__":
    run_robot_tests()